﻿using System;

namespace VoteForAnna
{
	public static class Extensions
	{
		public static void shuffle(this string[] array)
		{
			Random rng = new Random();   // i.e., java.util.Random.
			int n = array.Length;        // The number of items left to shuffle (loop invariant).
			while (n > 1)
			{
				int k = rng.Next(n);  // 0 <= k < n.
				n--;                     // n is now the last pertinent index;
				string temp = array[n];     // swap array[n] with array[k] (does nothing if k == n).
				array[n] = array[k];
				array[k] = temp;
			}
		}
	}
}